#include "MessengerNotebook.h"
#include "MessengerPanel.h"

#include "MsnContact.h"
#include "MsnMessenger.h"
#include "MsnDef.h"

int ID_MESSENGER_NOTEBOOK = wxNewId();

BEGIN_EVENT_TABLE(MessengerNotebook,NotebookCtrl)
    //EVT_NOTEBOOK_PAGE_CHANGED(ID_MESSENGER_NOTEBOOK, MessengerNotebook::OnPageChanged)
END_EVENT_TABLE()

MessengerNotebook::MessengerNotebook(wxWindow *parent)
	: NotebookCtrl(parent, ID_MESSENGER_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxNB_BOTTOM)
{
	SetImageList(&MsnDef::ICON_LIST);
	
	//this->Connect(ID_MESSENGER_NOTEBOOK,wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,wxNotebookEventHandler(MessengerNotebook::OnPageChanged));
}

void MessengerNotebook::CreateMessengerPanel()
{
	MessengerPanel* messengerPanel = new MessengerPanel(this);
	AddPage(messengerPanel, _("New Page"), true, ICON_CONTACT_OFFLINE);
	messengerPanel->LocateFocus();
}

void MessengerNotebook::UpdatePanelTitle(MessengerPanel* panel, const wxString& title)
{
	int index = GetPageIndex(panel);
	SetPageText(index, title);
}

void MessengerNotebook::UpdatePanelImage(MessengerPanel* panel, int index)
{
	int pageIndex = GetPageIndex(panel);
	SetPageImage(pageIndex, index);
}
